package com.ruoyi.master.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.master.mapper.TWechatUsersMapper;
import com.ruoyi.master.domain.TWechatUsers;
import com.ruoyi.master.service.ITWechatUsersService;

/**
 * 微信用户Service业务层处理
 * 
 * @author jiandan
 * @date 2024-09-19
 */
@Service
public class TWechatUsersServiceImpl implements ITWechatUsersService 
{
    @Autowired
    private TWechatUsersMapper tWechatUsersMapper;

    /**
     * 查询微信用户
     * 
     * @param userId 微信用户主键
     * @return 微信用户
     */
    @Override
    public TWechatUsers selectTWechatUsersByUserId(Long userId)
    {
        return tWechatUsersMapper.selectTWechatUsersByUserId(userId);
    }

    /**
     * 查询微信用户列表
     * 
     * @param tWechatUsers 微信用户
     * @return 微信用户
     */
    @Override
    public List<TWechatUsers> selectTWechatUsersList(TWechatUsers tWechatUsers)
    {
        return tWechatUsersMapper.selectTWechatUsersList(tWechatUsers);
    }

    /**
     * 新增微信用户
     * 
     * @param tWechatUsers 微信用户
     * @return 结果
     */
    @Override
    public int insertTWechatUsers(TWechatUsers tWechatUsers)
    {
        tWechatUsers.setCreateTime(DateUtils.getNowDate());
        return tWechatUsersMapper.insertTWechatUsers(tWechatUsers);
    }

    /**
     * 修改微信用户
     * 
     * @param tWechatUsers 微信用户
     * @return 结果
     */
    @Override
    public int updateTWechatUsers(TWechatUsers tWechatUsers)
    {
        tWechatUsers.setUpdateTime(DateUtils.getNowDate());
        return tWechatUsersMapper.updateTWechatUsers(tWechatUsers);
    }

    /**
     * 批量删除微信用户
     * 
     * @param userIds 需要删除的微信用户主键
     * @return 结果
     */
    @Override
    public int deleteTWechatUsersByUserIds(Long[] userIds)
    {
        return tWechatUsersMapper.deleteTWechatUsersByUserIds(userIds);
    }

    /**
     * 删除微信用户信息
     * 
     * @param userId 微信用户主键
     * @return 结果
     */
    @Override
    public int deleteTWechatUsersByUserId(Long userId)
    {
        return tWechatUsersMapper.deleteTWechatUsersByUserId(userId);
    }

    @Override
    public TWechatUsers selectTWechatUsersByOpenid(String openid) {
        return tWechatUsersMapper.selectTWechatUsersByOpenid(openid);
    }
}
